<?php

namespace backend\models\form;

use Yii;

/**
 * This is the model class for table "form_project".
 *
 * @property string $uuid 主键
 * @property string $department_id 学校|department
 * @property string $parent_id 父级id
 * @property string $name 名称
 * @property string|null $description 说明
 * @property string|null $attachment_id 任务书
 * @property int|null $is_achievement 是否标志性成果:0 否;1 是
 * @property int $px 顺序(对一级来说px 1和2的为专业群一二)
 * @property int|null $start_time 预计开始时间
 * @property int|null $end_time 预计结束时间
 * @property int $level 级别
 * @property int|null $progress_status 项目状态:0 未分配;1 未发布;2;已发布;3 进行中;4 已完成;5 未完成
 * @property int $status 状态:1 使用;2 注销
 * @property string $create_time 创建时间
 * @property string $update_time 修改时间
 * @property string $create_users_id 创建人
 * @property string $update_users_id 修改人
 */
class FormProject extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'form_project';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['uuid', 'department_id', 'name', 'px', 'level', 'status', 'create_users_id', 'update_users_id', 'start_time', 'end_time',], 'required'],
            [['description'], 'string'],
            [['is_achievement', 'px', 'level', 'progress_status', 'status'], 'integer'],
            [['create_time', 'update_time'], 'safe'],
            [['uuid', 'department_id', 'parent_id', 'attachment_id', 'create_users_id', 'update_users_id'], 'string', 'max' => 36],
            [['name'], 'string', 'max' => 100],
            [['uuid'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'uuid' => 'Uuid',
            'department_id' => 'Department ID',
            'parent_id' => 'Parent ID',
            'name' => '项目名称',
            'description' => '说明',
            'attachment_id' => '任务书ID',
            'is_achievement' => '是否标志性成果',
            'px' => '顺序',
            'start_time' => '预计开始时间',
            'end_time' => '预计结束时间',
            'level' => '级别',
            'progress_status' => '项目状态',
            'status' => 'Status',
            'create_time' => 'Create Time',
            'update_time' => 'Update Time',
            'create_users_id' => 'Create Users ID',
            'update_users_id' => 'Update Users ID',
        ];
    }

    // 1：是； 2：否
    const CHOOSE_YES = 1;
    const CHOOSE_NO = 0;
    static $yes_no_dict = [
        self::CHOOSE_YES => '是',
        self::CHOOSE_NO => '否',
    ];

    const STATUS_UN_PUBLISH = 1;
    const STATUS_PUBLISHED = 2;
    const STATUS_UNDERWAY = 3;
    // progress_status
    public static $progress_status_dict = [
        self::STATUS_UN_PUBLISH => '未发布',
        self::STATUS_PUBLISHED => '已发布',
        self::STATUS_UNDERWAY => '进行中',
    ];
}
